<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
</head>
<body>
    <pre>
       from functools import wraps


        class AuthClass():
            def __init__(self, name, pwd):
                self.name = name
                self.pwd = pwd

            def auth(self):
                if self.name == 'python' and self.pwd == 123:
                    return True
                else:
                    return False


        user = AuthClass("java", 123)


        def auth(p):
            @wraps(p)
            def inner(*args, **kwargs):
                if not user.auth():
                    print("用户名或者密码错误！")
                    return False
                else:
                    return p(*args, **kwargs)
            return inner

        @auth
        def pi():
            return "用户名和密码检验:"


        print(pi())

    </pre>
</body>
</html>